package com.yanqu.road.server.cmd.activity.unionwar;

import com.yanqu.road.pb.activity.unionwar.CrossUnionWarProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.manger.activity.unionwar.UnionPhaseWarMgr;
import com.yanqu.road.server.manger.activity.unionwar.UnionWar;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = Protocol.S_CROSS_UNION_WAR_JOIN_UNION_SYNC_RESP,desc = "参数资格推送结果从跨服")
public class UnionWarNameListPushResultCmdFormCross implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        CrossUnionWarProto.CrossUnionWarJoinUnionListSyncRespMsg resultMsg = CrossUnionWarProto.CrossUnionWarJoinUnionListSyncRespMsg.parseFrom(packet.getBytes());
        UnionWar unionWar = UnionPhaseWarMgr.getUnionWarMap().get(resultMsg.getActivityId());
        if(unionWar != null){
            unionWar.syncNameListResponseFromCross(resultMsg.getUnionUidListList());
        }
    }
}
